package com.org.flow.element.logger;

import com.org.flow.system.service.LogService;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;


/**
 * 类描述：定义异常后处理异常的组件 （* 如果声明了组件处理的话 事务会提交和JAVA try()catch()同理）
 *
 * @version 1.0.0
 * @since 1.0.0  2024-02-26 09:45:03
 */
@LiteflowComponent(value = "businessLog", name = "流程异常日志记录")
@Slf4j
@RequiredArgsConstructor
public class CompBusinessLog extends NodeComponent {

    private final LogService logService;

    @Override
    public void process() {
//        Exception e = this.getSlot().getException();
//        BusinessExceptionLogDTO dto = new BusinessExceptionLogDTO();
//        log.error("-------------------------------- 日志 落库 ！！！");
//        Object obj = this.getSubChainReqData();
//        BeanMap map = new BeanMap(obj);
//        dto.setBusinessId(String.valueOf(map.getOrDefault("id", "")));
//        dto.setBusinessExt1(String.valueOf(map.getOrDefault("errorRemark", "")));
//        dto.setBusinessExt2("备注二");
//        dto.setBusinessExt3("备注三");
//        logService.insErrorLog(dto, e);
        this.setIsEnd(true);
        this.isEnd();
    }


}
